home *** CD-ROM | disk | FTP | other *** search
/ Clickx 115 / Clickx 115.iso / software / tools / windows / tails-i386-0.16.iso / live / filesystem.squashfs / etc / bash_completion.d / ant < prev    next >
Encoding:
Text File  |  2010-11-16  |  1.9 KB  |  72 lines

  1. # bash completion for ant
  2.  
  3. have ant &&
  4. {
  5. _ant()
  6. {
  7.     local cur prev buildfile i
  8.  
  9.     COMPREPLY=()
  10.     _get_comp_words_by_ref cur prev
  11.  
  12.     case $prev in
  13.         -buildfile|-file|-f)
  14.             _filedir 'xml'
  15.             return 0
  16.             ;;
  17.         -logfile|-l)
  18.             _filedir
  19.             return 0
  20.             ;;
  21.         -propertyfile)
  22.             _filedir properties
  23.             return 0
  24.             ;;
  25.         -nice)
  26.             COMPREPLY=( $( compgen -W '1 2 3 4 5 6 7 8 9 10' -- "$cur" ) )
  27.             return 0
  28.             ;;
  29.         -lib|-logger|-listener|-D|-inputhandler|-main)
  30.             return 0
  31.             ;;
  32.     esac
  33.  
  34.     if [[ "$cur" == -* ]]; then
  35.         COMPREPLY=( $( compgen -W '-help -projecthelp -version -diagnostics \
  36.             -quiet -verbose -debug -emacs -lib -logfile -logger -listener \
  37.             -noinput -buildfile -D -keep-going -propertyfile -inputhandler \
  38.             -find -s -nice -nouserlib -noclasspath -autoproxy -main' \
  39.             -- "$cur" ) )
  40.     else
  41.         # available targets completion
  42.         # find which buildfile to use
  43.         buildfile=build.xml
  44.         for (( i=1; i < COMP_CWORD; i++ )); do
  45.             if [[ "${COMP_WORDS[i]}" == -@(?(build)file|f) ]]; then
  46.                 buildfile=${COMP_WORDS[i+1]}
  47.                 break
  48.             fi
  49.         done
  50.         [ ! -f $buildfile ] && return 0
  51.  
  52.         # parse buildfile for targets
  53.         # some versions of sed complain if there's no trailing linefeed,
  54.         # hence the 2>/dev/null
  55.         COMPREPLY=( $( compgen -W "$( cat $buildfile | tr "'\t\n>" "\"  \n" | \
  56.             sed -ne 's/.*<target .*name="\([^"]*\).*/\1/p' 2>/dev/null )" \
  57.             -- "$cur" ) )
  58.         fi
  59. }
  60. have complete-ant-cmd.pl && \
  61.      complete -C complete-ant-cmd.pl -F _ant -o filenames ant || \
  62.      complete -F _ant -o filenames ant
  63. }
  64.  
  65. # Local variables:
  66. # mode: shell-script
  67. # sh-basic-offset: 4
  68. # sh-indent-comment: t
  69. # indent-tabs-mode: nil
  70. # End:
  71. # ex: ts=4 sw=4 et filetype=sh
  72.